import {
	createStore
} from 'vuex'
import persistedState from 'vuex-persistedstate'
import RouterHook from '@/router/hook'

const files = require.context('./modules/', false, /\.js$/)
let modules = {}
files.keys().forEach(key => {
	modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
})

export default createStore({
	modules,
	plugins: [RouterHook(),persistedState()]
})
